;$(function () {

  $(".goodsr").on("mouseenter", ".goods", function () {
    $(this).find(".buy").stop().animate({"top": "213"}, 500);
  }).on("mouseleave", ".goods", function () {
    $(this).find(".buy").stop().animate({"top": "300"}, 600);
  })

  $(".buy").on("click", function () {
    location = "details.html";
  })
  if (!localStorage.getItem('userinfo')){
    layer.msg("请先登录或者注册再访问本站");
    setTimeout(function () {
      location = "login.html"
    },2000)
  }
  let userInfo = JSON.parse(localStorage.getItem('userinfo') || '[]');



  $(".bar-left").children().children().eq(1).text(`hi,${userInfo[0].u_name}`);
  $(".bar-left").children().children().eq(2).on("click", function () {
    localStorage.clear();
    $(".bar-left").children().children().eq(1).html("<a href='./login.html'>登录</a>")
  })
})